import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:study_demo/widgets/shader_painter.dart';

import 'shader_controller.dart';

class ShaderPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<ShaderController>(
        init: ShaderController(),
        builder: (controller) {
          return Scaffold(
              appBar: AppBar(title: Text('shader')),
              body: Center(
                  child: controller.shader1 == null ||
                          controller.uiImage == null
                      ? CircularProgressIndicator()
                      : Row(
                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                          children: [
                            CustomPaint(
                                size: Size(200, 200),
                                painter: ShaderPainter(controller.shader1!,
                                    image: controller.uiImage!)),
                            CustomPaint(
                                size: Size(200, 200),
                                painter: ShaderPainter(controller.shader2!)),
                            CustomPaint(
                                size: Size(200, 200),
                                painter: ShaderPainter(controller.shader3!)),
                            Column(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                CustomPaint(
                                    size: Size(200, 200),
                                    painter:
                                        ShaderPainter(controller.shader3!)),
                              ],
                            ),
                          ],
                        )));
        });
  }

  _radio() {
    return Row(
      children: [],
    );
  }
}
